home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / metzphon.zip / WINWORD.TXT < prev   
Text File  |  1991-05-07  |  1KB  |  47 lines

  1. '=============================================================
  2. ' Dial Macro for Word for Windows using METZ Phones
  3. ' Noel Sterrett, 1991
  4. '=============================================================
  5. ' This macro uses METZ Phones to dial a telephone number which is
  6. ' highlighted in Word.  If a DDE timeout occurs, add "DDETMEOUT=n"
  7. ' to WIN.INI under the heading "[Microsoft Word]".
  8. ' Adjust n (seconds) for your needs.
  9. Sub MAIN
  10. dial$=PrepairDial$(Selection$())
  11. Print dial$
  12.  
  13. DDETerminateAll
  14. chan=DDEInitiate("PHONES", "DIAL")
  15. DDEExecute chan, dial$
  16. DDETerminate chan
  17.  
  18. End Sub
  19.  
  20. '-----------
  21. Function PrepairDial$(numb$)
  22. 'the following codes should be modified to suit your telephone system:
  23. local$="99,"
  24. long$="99,1,"
  25. mci$="99,1,"
  26. bill$=",,,,,,31"
  27.  
  28. tele$=""
  29. junk$="()-,."
  30. For i=1 To Len(numb$)
  31.     ch$=Mid$(numb$, i, 1)
  32.     If InStr(junk$, ch$) = 0 Then tele$=tele$+ch$
  33. Next i
  34.  
  35. code=Int(Val(tele$) / 10000000)
  36. If Val(tele$) < 10000 Then    'inside call
  37.    PrepairDial$=tele$
  38. ElseIf code=0 Then            'local call
  39.    PrepairDial$=local$+tele$
  40. ElseIf code=800 Then          'free call
  41.    PrepairDial$=long$+tele$
  42. Else                          'long distance pay call
  43.    PrepairDial$=long$+tele$
  44. End If
  45.  
  46. End Function
  47.